
/*---------------------------------------------------------
   Initializes the effect. The data is a table of data 
   which was passed from the server.
---------------------------------------------------------*/
function EFFECT:Init( data )
	
	local TargetEntity = data:GetEntity()
	if ( !TargetEntity || !TargetEntity:IsValid() ) then return end
	
	local vOffset = TargetEntity:GetPos()
	local Low, High = TargetEntity:WorldSpaceAABB()

	local NumParticles = TargetEntity:BoundingRadius()
	NumParticles = math.Clamp(  NumParticles * 6, 50, 350 )
		
	local emitter = ParticleEmitter( vOffset )
		for i=0, NumParticles do
			local vPos = Vector( math.Rand(Low.x,High.x), math.Rand(Low.y,High.y), math.Rand(Low.z,High.z) )
			local particle = emitter:Add( "effects/blueflare1", vPos )
			particle:SetVelocity( ((vPos - vOffset) * math.Rand(1,3)) + Vector(0,0,math.Rand(1,3)) )
			particle:SetLifeTime( 0 )
			particle:SetColor( 50,50,math.random(100,250),250 )
			particle:SetDieTime( math.Rand( 1, 2 ) )
			particle:SetStartAlpha( math.Rand( 100, 150 ) )
			particle:SetEndAlpha( 0 )
			particle:SetStartSize( math.Rand(1,1.5) )
			particle:SetEndSize( 0 )
			particle:SetRoll( math.Rand(0, 360) )
			particle:SetRollDelta( 0 )
				
			particle:SetAirResistance( 100 )
			particle:SetGravity( Vector( 0, 0, -50 ) )
			particle:SetCollide( true )
			particle:SetBounce( 0.6 )
		end
	emitter:Finish()
end


/*---------------------------------------------------------
   THINK
---------------------------------------------------------*/
function EFFECT:Think( )
	return false
end

/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render()
end
